package com.recorder.ui.card

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import com.recorder.R
import kotlinx.android.synthetic.main.activity_card.*

/**
 * Created by YWQ on 2018/9/14.
 * 包名:com.recorder.ui.card
 * 描述:
 */
class CardActivity : AppCompatActivity() {

    var isFirst = true

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContentView(R.layout.activity_card)


        takePic.setOnClickListener {
            if (isFirst) {
                cameraSurfaceView.takePicture(1)

            } else {
                cameraSurfaceView.takePicture(2)


            }
            isFirst = !isFirst
        }

        cameraSurfaceView.setTakePhotoEndListener({
            when (it) {

                1 -> {
                    rectOnCamera.TIPS = "请将身份证反面放入框中"
                    rectOnCamera.invalidate()
                }


                2 -> {
                    rectOnCamera.TIPS = "点击返回键返回上个界面"
                    rectOnCamera.invalidate()

                }

            }

        })
    }


}